package org.example;

public class DailyNecessity extends Product {
    private String material;       // 材质
    private boolean isRecyclable;  // 是否可回收

    public DailyNecessity() {

    }
    public DailyNecessity(String id, String name, double price, int quantity,
                          String material, boolean isRecyclable) {
        super(id, name, price, quantity);
        this.material = material;
        this.isRecyclable = isRecyclable;
    }

    // getter 和 setter 方法
    public String getMaterial() {
        return material;
    }

    public void setMaterial(String material) {
        this.material = material;
    }

    public boolean isRecyclable() {
        return isRecyclable;
    }

    public void setRecyclable(boolean recyclable) {
        isRecyclable = recyclable;
    }

    // 重写显示信息方法
    @Override
    public void result() {
        super.result();
        System.out.println("材质: " + material);
        System.out.println("是否可回收: " + (isRecyclable ? "是" : "否"));
    }
}
